package com.AAA.service.Impl.scl;

import com.AAA.entity.MyPage;
import com.AAA.entity.scl.TSclRecord;
import com.AAA.service.scl.TSclRecordService;
import com.AAA.dao.scl.TSclRecordMapper;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * (TSclRecord)表服务实现类
 *
 * @author makejava
 * @since 2022-10-31 09:43:16
 */
@Service
public class TSclRecordServiceImpl implements TSclRecordService {
   @Autowired
   private TSclRecordMapper tSclRecordMapper;

   @Override
   public int login(TSclRecord tSclRecord) {
      tSclRecord.setCreatetime(new Date());
      int insert = tSclRecordMapper.insertDl(tSclRecord);
      Integer integer = tSclRecordMapper.selectByTel(tSclRecord);
      return integer;
   }

   @Override
   public TSclRecord checkrecord(TSclRecord record) {
      TSclRecord tSclRecord = tSclRecordMapper.selectTwo(record);
      return tSclRecord;
   }

   @Override
   public PageInfo getAll(MyPage myPage, TSclRecord tSclRecord) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
//      Example example = new Example(TSclRecord.class);
//      //example.createCriteria().andEqualTo("username",record.getUsername());
//      example.setOrderByClause("createtime desc");
      List<TSclRecord> select = tSclRecordMapper.selectByExampleScl(tSclRecord);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }

   @Override
   public PageInfo getDetailMsg(Integer id, MyPage myPage) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      List<Map<String,Object>> details = tSclRecordMapper.getDetails(id);
      PageInfo pageInfo = new PageInfo<>(details);
      return pageInfo;
   }

   @Override
   public PageInfo tj1(MyPage myPage, TSclRecord tSclRecord) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      List<TSclRecord> select = tSclRecordMapper.selecttj1(tSclRecord);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }




}
